<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>计算银行卡余额案例</title>
  <style>
    h2{
      text-align: center;
    }
    table {
      border-collapse: collapse;
      height: 80px;
      margin: 0 auto;
      text-align: center;
    }
    th{
      padding: 5px 20px;
    }
    table,th,td{
      border: 1px solid #000;
    }
  </style>
</head>
<body>
  <h2>消费支出</h2>
<script>
    let total = +prompt("请输入银行卡总额");
    let water = +prompt("请输入水费");
    let electric = +prompt("请输入电费");
    let net = +prompt("请输入网费");
    let b = total - water - electric - net;
    alert("计算成功！您的银行卡剩余余额为：" + b.toFixed(2) + " 元");
    document.write("<table><tr><th>银行卡总额</th><th>水费</th><th>电费</th><th>网费</th><th>剩余余额</th></tr><tr><td>" + total + "</td><td>" + water + "</td><td>" + electric + "</td><td>" + net + "</td><td>" + b.toFixed(2) + "</td></tr></table>");
</script>
</body>
</html>